let nums = [0, 1, 0, 3, 12]
var moveZeroes = function (nums) {
    if (nums.length === 0) {
        return
    }
    let arr = []
    for (let i = 0; i < nums.length; i++) {
        if (nums[i] === 0) {
            arr.push(i)
        }
    }
    if (arr.length === 0) {
        return nums
    }
    j
    for (let j = 0; j < arr.length; j++) {
        nums.splice(arr[j] - j, 1)
        nums.push(0)
    }
    return nums
};
console.log(moveZeroes(nums));
